﻿
Public Class Main
    Private Capm As Cam

    Private Sub Main_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        Capm.Stop()
        Capm = Nothing
    End Sub

    Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Capm = New Cam(CamPic.Handle, 0, 0, CamPic.Width, CamPic.Height)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Capm.Start()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Capm.Stop()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Capm.GrabImage(Application.StartupPath & "\Image\1.bmp")
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Capm.capDlgVideoFormat()
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Capm.capDlgVideoSource()
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Capm.Kinescope(Application.StartupPath & "\Image\1.avi")
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Capm.capDlgVideoCompression()
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        Capm.StopKinescope()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Try
            'Dim n As New Bitmap(CamPic.Image)
            'n.RotateFlip(RotateFlipType.Rotate180FlipX)
            Capm.GrabImage(Application.StartupPath & "\Image\1.bmp")
            PictureBox1.Load(Application.StartupPath & "\Image\1.bmp")
            Dim n As New Bitmap(PictureBox1.Image)
            n.RotateFlip(RotateFlipType.Rotate180FlipX)
            PictureBox1.Image = n
        Catch ex As Exception
            Debug.Print("hello")
        End Try

    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

    End Sub
End Class
